<?php
/**
 * Created by JetBrains PhpStorm.
 * User: Fabrice
 * Date: 21/02/14
 * Time: 19:13
 * To change this template use File | Settings | File Templates.
 */

class ControleurVisiteur
{
    public function ControleurVisiteur()
    {
        require_once (Chemins::MODELES."ModeleNews.class.php");
    }

    public function afficherLesNews()
    {
        if (isset($_REQUEST['debut']))
        {
            VariablesGlobales::$debutTuples = $_REQUEST['debut'];
        }
        VariablesGlobales::$nbTuplesTotal = ModeleNews::getNbNews();
        VariablesGlobales::$lesNews = ModeleNews::getLesNewsLimit(VariablesGlobales::$debutTuples, 6);

        include_once (Chemins::VUES.'v_News.php');
    }

    public function afficherAccueil()
    {
        $dirname = Chemins::PHOTOS;
        $dir = opendir($dirname);
        //On parcours tout les fichiers dans le dossier
        while($file = readdir($dir))
        {
            if($file != '.' && $file != '..' && !is_dir($dirname.$file))
            {
                VariablesGlobales::$lesLiensImages[] = $dirname.$file;
            }
        }
        closedir($dir);

        include_once (Chemins::VUES.'v_Accueil.php');
    }

    public function afficherMusiques()
    {
        include_once (Chemins::VUES.'v_Musiques.php');
    }

    public function afficherVidéos()
    {
        include_once (Chemins::VUES.'v_Videos.php');
    }

    public function afficherConcerts()
    {
        require_once (Chemins::MODELES.'ModeleConcert.class.php');
        VariablesGlobales::$lesConcerts = ModeleConcert::getLesConcertsOrderByDate();
        include_once (Chemins::VUES.'v_Concerts.php');
    }
}